package com.raos.lottery.redis.controller;


import com.raos.lottery.redis.constants.ReturnCodeEnum;
import com.raos.lottery.redis.dal.model.LotteryRecord;
import com.raos.lottery.redis.service.ILotteryRecordService;
import com.raos.lottery.redis.service.dto.ResultResp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 抽奖记录控制器
 *
 * @author raos
 * @emil 991207823@qq.com
 * @date 2021/7/21 23:01
 */
@RestController
@RequestMapping("/lottery-record")
public class LotteryRecordController {

    @Autowired
    ILotteryRecordService lotteryRecordService;

    @GetMapping
    public ResultResp<List<LotteryRecord>> records(){
        List<LotteryRecord> records=lotteryRecordService.list();
        ResultResp resultResp=new ResultResp();
        resultResp.setMsg(ReturnCodeEnum.SUCCESS.getMsg());
        resultResp.setCode(ReturnCodeEnum.SUCCESS.getCode());
        resultResp.setResult(records);
        return resultResp;
    }
}
